<?php
	//session_start();          // 为什么注销这个呢，因为sidebar.php 已经有session_start();了 这个开启会有warning.
	include_once("conn.php");
	
	$get_board = $_GET["board"];
	
	$sql = "select * from bbs_session where s_name = '".$get_board."'";
	$result = mysql_query($sql);
	$q_result = mysql_fetch_array($result);
	if($q_result["s_id"])
	{
		$board_name = $get_board;				//版面名
		$board_admin_name = $q_result["s_admin_name"];		//版主名
		$board_topic_num = $q_result["s_topic_num"];		//版面帖子总数
	}
	else 
	{
		echo "版面不存在，请创建版面，或者检查链接<a>";
	}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset=utf-8 />
<link rel = "stylesheet" href = "board.css" style = "text/css" />
<link rel = "stylesheet" href = "jiaobu.css" style = "text/css" />
<link rel = "stylesheet" href = "sidebar.css" style = "text/css" />
<link rel = "stylesheet" href = "board_header.css" style = "text/css" />

</head>
<body>
<div class = "header">
	<h3><a href = "#"><?php echo $board_name; ?></a> -- 讨论区 版主:<a href = "#"><?php echo $board_admin_name;  ?></a></h3>
	<p>本讨论区共有帖子<strong><?php echo $board_topic_num; ?></strong>篇  &nbsp&nbsp&nbsp&nbsp<a href="public.php?board=<?php echo $board_name; ?>">发表主题</a></p>
	<hr />
</div>

<div class = "body">
	<?php include_once("sidebar.php"); ?>
	
	<div class = "banmian">
		<table class = "tb_board">
			<tr>
				<th>作者</th>
				<th>发表时间</th>
				<th class = "bt">标题</th>
				<th>回帖/人气</th>
				<th>最新回复</th>
			</tr>
			
			<?php
				$sql = "select * from bbs_topic where t_session_name = '".$board_name."'";
				$result = mysql_query($sql);
			
				while($q_result = mysql_fetch_array($result))
				{
					$author = $q_result["t_author"];
					$post_time = $q_result["t_time"];
					$post_title = $q_result["t_topic"];
					$post_id = $q_result["t_id"];				//帖子编号
			?>
			<tr>
				<td><a href = "#"><?php echo $author; ?></a></td>
				<td><a><?php echo $post_time;  ?></a></td>
				<td><a href = "browse.php?board=<?php echo $board_name; ?>&tid=<?php echo $post_id;  ?>"><?php echo $post_title; ?></a></td>
				<td><a></a></td>
				<td><a></a></td>
			</tr>
			<?php
				}

			?>			

		</table>
	</div>
</div>

<div class = "footer">
	<?php include_once("jiaobu.php"); ?>
</div>



</body>
</html>